package dayOOP0718;

public enum Season {

    //1.用来规定成员变量seasonName数值的代码//调用下边的构造方法
    SPRING("春天"), SUMMER("夏天"),AUTUMN("秋天"),WINTER("冬天");

    //2.成员变量
    private  String  seasonName;

    //3.构造方法
    Season(String name){
        this.seasonName=name;
    }

    //4.get  set方法
    public String getSeasonName() {
        return seasonName;
    }
    public void setSeasonName(String seasonName) {
        this.seasonName = seasonName;
    }
}

class SeasonTest{
    public static void main(String[] args) {
        Season  s=Season.SPRING;//Season对象的成员变量seasonName的值是"春天"
        Season[]  vals=Season.values();//获取四个值
        for (int i = 0; i <vals.length ; i++) {
            System.out.println(vals[i]);
            System.out.println(vals[i].getSeasonName());
        }
    }
}
